﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace handvn.Models
{
    public class ProductDAO
    {
        public bool ktTrung(Product model)
        {
            List<Product> danhsach = laydanhsachSP();
            foreach (Product sp in danhsach)
            {
                if (sp.TenSanPham == model.TenSanPham)
                    return true;
            }
            return false;
        }
        public List<Product> laydanhsachSP()
        {
            var db = new HandvnContext();
            var query = from p in db.Products
                        select p;
            List<Product> danhsach = query.ToList();
            return danhsach;
        }
    }
}